package com.atgm.common.utils;

import com.baomidou.mybatisplus.core.toolkit.IdWorker;

import java.util.List;
import java.util.Map;
import java.util.Set;

public class GmMallUtils {

    /**
     * 判断是否为空
     * @return
     */
    public static boolean isEmpty(Object object){
        if (object == null){
            return true;
        }
        if (object instanceof String){
            if (object == null || "".equals((String) object)){
                return true;
            }
        }else if (object instanceof List){
            if (object == null || ((List) object).isEmpty()){
                return true;
            }
        }else if (object instanceof Set){
            if (object == null || ((Set) object).isEmpty()){
                return true;
            }
        }else if (object instanceof Map){
            if (object == null || ((Map) object).isEmpty()){
                return true;
            }
        }
        return false;
    }

    /**
     * 判断值非空
     * @param object
     * @return
     */
    public static boolean isNotEmpty(Object object){
        return !isEmpty(object);
    }

    /**
     * 生成用户id
     * @return
     */
    public static Long createMemberId() {
        return IdWorker.getId();
    }

}
